﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for FactoryEmpl
/// </summary>
public abstract class Factory<T>
{
    public static T CreateInstance()
    {
        //Employee
        if (typeof(T) == typeof(IEmployeeDAL))
        {
            IEmployeeDAL obj = new EmployeeDAL();
            return (T)obj;
        }
        else if (typeof(T) == typeof(IEmployeeBLL))
        {
            IEmployeeBLL obj = new EmployeeBLL();
            return (T)obj;
        }


        //Permission
        else if (typeof(T) == typeof(IPermissionDAL))
        {
            IPermissionDAL obj = new PermissionDAL();
            return (T)obj;
        }
        else if (typeof(T) == typeof(IPermissionBLL))
        {
            IPermissionBLL obj = new PermissionBLL();
            return (T)obj;
        }

        //Shift
        else if (typeof(T) == typeof(IShiftDAL))
        {
            IShiftDAL obj = new ShiftDAL();
            return (T)obj;
        }
        else if (typeof(T) == typeof(IShiftBLL))
        {
            IShiftBLL obj = new ShiftBLL();
            return (T)obj;
        }


        //CardType
        else if (typeof(T) == typeof(ICardTypeDAL))
        {
            ICardTypeDAL obj = new CardTypeDAL();
            return (T)obj;
        }
        else if (typeof(T) == typeof(ICardTypeBLL))
        {
            ICardTypeBLL obj = new CardTypeBLL();
            return (T)obj;
        }

        //DayNight
        else if (typeof(T) == typeof(IDayNightDAL))
        {
            IDayNightDAL obj = new DayNightDAL();
            return (T)obj;
        }
        else if (typeof(T) == typeof(IDayNightBLL))
        {
            IDayNightBLL obj = new DayNightBLL();
            return (T)obj;
        }


        //CardPrice
        else if (typeof(T) == typeof(ICardPriceDAL))
        {
            ICardPriceDAL obj = new CardPriceDAL();
            return (T)obj;
        }
        else if (typeof(T) == typeof(ICardPriceBLL))
        {
            ICardPriceBLL obj = new CardPriceBLL();
            return (T)obj;
        }       

        return default(T);
    }
}